﻿@inject IEventService _eventService

<MResponsive AspectRatio="AspectRatio">
    <MCarousel Cycle Height="@("inherit")"
               HideDelimiterBackground
                Interval="4000"
                HideDelimiters="HideDelimiters"
               ShowArrowsOnHover>
        @foreach (var item in Model.OrderByDescending(s => s.Priority))
        {
            <MCarouselItem>
                <MDCard Class="ma-1" Href="@item.Link" Target="@(item.Link.Contains("http")?"_blank":"_self")" OnClick="@(async ()=>await OnClick.InvokeAsync(item))">
                    <img src="@item.Image" alt="@item.Note" class="w-100" style="@($" aspect-ratio: {AspectRatio.ToDouble()};")" />
                </MDCard>
            </MCarouselItem>
        }

    </MCarousel>
</MResponsive>
@code {
    [Parameter]
    public List<CarouselViewModel> Model { get; set; }
    [Parameter]
    public EventCallback<CarouselViewModel> OnClick { get; set; }
    [Parameter]
    public bool HideDelimiters { get; set; } = true;
    [Parameter]
    public StringNumber AspectRatio { get; set; } = 1024 / 200D;
}
